package a.a;

import a.c.a;
import a.c.ab;
import a.c.bb;
import a.c.d;
import a.c.e;
import a.c.q;
import a.c.w;
import a.c.z;
import a.i.db;
import a.i.l;

public class jb
{
  public static int a;
  
  private static void a(q paramq, ab paramab)
  {
    int k = m.b;
    boolean bool = m.a;
    if (k == 0) {}
    ab localab = paramab != null ? paramab : new ab();
    int[] arrayOfInt1 = new int[paramq.k()];
    int[] arrayOfInt2 = new int[paramq.k()];
    h local0 = new h()
    {
      private final int[] val$dfsNumbers;
      private final int[] val$compNumbers;
      
      protected void a(e paramAnonymouse, int paramAnonymousInt1, int paramAnonymousInt2)
      {
        this.val$dfsNumbers[paramAnonymouse.f()] = paramAnonymousInt1;
        this.val$compNumbers[paramAnonymouse.f()] = paramAnonymousInt2;
      }
    };
    local0.a(true);
    local0.a(paramq);
    a.c.m localm = paramq.w();
    do
    {
      if (!localm.e()) {
        break;
      }
      d locald = localm.a();
      int i = locald.e().f();
      int j = locald.f().f();
      if (k == 0)
      {
        if (arrayOfInt1[i] > arrayOfInt1[j])
        {
          if (k != 0) {
            continue;
          }
          if (arrayOfInt2[i] < arrayOfInt2[j])
          {
            localab.add(locald);
            paramq.f(locald);
          }
        }
        localm.f();
      }
    } while (!bool);
  }
  
  private static boolean a(q paramq)
  {
    int j = m.b;
    boolean bool = m.a;
    int[] arrayOfInt = d(paramq);
    if ((j != 0) || (arrayOfInt.length == 0)) {
      return false;
    }
    bb localbb = x.d(paramq, arrayOfInt);
    z localz = new z();
    a(localbb, localz);
    bb[] arrayOfbb = new bb[localz.size()];
    localz.toArray(arrayOfbb);
    Object localObject = paramq.w();
    do
    {
      do
      {
        if (!((a.c.m)localObject).e()) {
          break;
        }
        paramq.a(((a.c.m)localObject).a());
        ((a.c.m)localObject).f();
      } while (!bool);
    } while (j != 0);
    int i = 0;
    label205:
    label207:
    do
    {
      do
      {
        if (i >= arrayOfbb.length) {
          break;
        }
        w localw = arrayOfbb[i].l();
        e locale = localw.d();
        localw.f();
        do
        {
          if (!localw.e()) {
            break;
          }
          localObject = locale;
          locale = localw.d();
          paramq.a((e)localObject, locale);
          localw.f();
          if (j != 0) {
            break label207;
          }
          if (bool) {
            break label205;
          }
        } while (!bool);
        if (j == 0) {
          i++;
        }
      } while (!bool);
    } while (j != 0);
    return true;
  }
  
  public static void b(q paramq)
  {
    b(paramq, null);
  }
  
  public static void b(q paramq, ab paramab)
  {
    int k = m.b;
    boolean bool = m.a;
    int[] arrayOfInt = d(paramq);
    bb localbb = x.d(paramq, arrayOfInt);
    z localz = new z();
    a(localbb, localz);
    bb[] arrayOfbb = new bb[localz.size()];
    localz.toArray(arrayOfbb);
    int[][] arrayOfInt1 = a(arrayOfbb, x.d(paramq, arrayOfInt), arrayOfInt);
    w localw1 = paramq.v();
    label230:
    label250:
    do
    {
      if (!localw1.e()) {
        break;
      }
      e locale1 = localw1.d();
      int i = arrayOfInt[locale1.f()];
      int j = 0;
      do
      {
        if (j >= arrayOfbb.length) {
          break;
        }
        if (bool) {
          break label250;
        }
        w localw2 = arrayOfbb[j].l();
        do
        {
          do
          {
            if (!localw2.e()) {
              break label230;
            }
            e locale2 = localw2.d();
            if (bool) {
              break;
            }
            if ((arrayOfInt1[j][i] <= arrayOfInt[locale2.f()]) && (locale1 != locale2))
            {
              if (k != 0) {
                continue;
              }
              if (!paramq.b(locale1, locale2))
              {
                d locald = paramq.a(locale1, locale2);
                if (k != 0) {
                  continue;
                }
                if (paramab != null) {
                  paramab.add(locald);
                }
              }
            }
            localw2.f();
          } while (!bool);
          j++;
        } while (k != 0);
      } while (!bool);
      if (k == 0) {
        localw1.f();
      }
    } while (!bool);
  }
  
  public static void c(q paramq)
  {
    c(paramq, null);
  }
  
  public static void c(q paramq, ab paramab)
  {
    int k = m.b;
    boolean bool = m.a;
    int[] arrayOfInt = d(paramq);
    bb localbb = x.d(paramq, arrayOfInt);
    e[] arrayOfe = localbb.p();
    d locald1 = arrayOfInt.length;
    boolean[][] arrayOfBoolean = new boolean[locald1][locald1];
    boolean[] arrayOfBoolean1 = new boolean[locald1];
    boolean[] arrayOfBoolean2;
    if (paramab != null)
    {
      arrayOfBoolean2 = new boolean[paramq.l()];
      if (k != 0) {
        break label76;
      }
      if (!bool) {}
    }
    else
    {
      arrayOfBoolean2 = null;
    }
    label76:
    d locald2 = locald1 - 1;
    label141:
    label578:
    label584:
    label599:
    label609:
    label612:
    label617:
    label629:
    label636:
    do
    {
      do
      {
        if (locald2 <= -1) {
          return;
        }
        int i = 0;
        if (i < locald1) {}
        do
        {
          arrayOfBoolean[locald2][i] = 0;
          i++;
          if ((k == 0) && (bool)) {
            break label141;
          }
          if (!bool) {
            break;
          }
          arrayOfBoolean[locald2][locald2] = 1;
        } while (k != 0);
        arrayOfBoolean1[locald2] = true;
        e locale1 = arrayOfe[locald2];
        locald3 = locale1.h();
        do
        {
          if (locald3 == null) {
            break label629;
          }
          e locale2 = locald3.f();
          d locald4 = arrayOfInt[locale2.f()];
          if (bool) {
            break label636;
          }
          if (arrayOfBoolean1[locald4] == 0)
          {
            d locald5 = locald4;
            do
            {
              if (locald5 >= locald1) {
                break;
              }
              if (bool) {
                break label261;
              }
              if (arrayOfBoolean[locald4][locald5] != 0)
              {
                if (k != 0) {
                  continue;
                }
                if (arrayOfBoolean1[locald5] == 0)
                {
                  arrayOfBoolean1[locald5] = true;
                  arrayOfBoolean[locald2][locald5] = 1;
                }
              }
              locald5++;
            } while (!bool);
          }
          if (k != 0) {
            break;
          }
          int j = locald2 + 1;
          do
          {
            do
            {
              d locald6;
              do
              {
                if (j >= locald4) {
                  break label612;
                }
                if (bool) {
                  break label636;
                }
                if (arrayOfBoolean[locald2][j] == 0) {
                  break label599;
                }
                if (k != 0) {
                  break label609;
                }
                if (arrayOfBoolean[j][locald4] == 0) {
                  break label599;
                }
                if (paramab != null)
                {
                  if (k == 0) {
                    if (locale2.d() < locale1.e())
                    {
                      locald6 = locale2.i();
                      do
                      {
                        if (locald6 == null) {
                          break label599;
                        }
                        if (bool) {
                          break;
                        }
                        if (locald6.e() == locale1)
                        {
                          if (k != 0) {
                            continue;
                          }
                          if (arrayOfBoolean2[locald6.d()] == 0)
                          {
                            arrayOfBoolean2[locald6.d()] = true;
                            paramab.add(locald6);
                          }
                        }
                        locald6 = locald6.j();
                      } while (!bool);
                    }
                  }
                  if (k != 0) {
                    break label617;
                  }
                  locald6 = locale1.h();
                  do
                  {
                    if (locald6 == null) {
                      break label599;
                    }
                    if (bool) {
                      break;
                    }
                    if (locald6.f() == locale2)
                    {
                      if (k != 0) {
                        continue;
                      }
                      if (arrayOfBoolean2[locald6.d()] == 0)
                      {
                        arrayOfBoolean2[locald6.d()] = true;
                        paramab.add(locald6);
                      }
                    }
                    locald6 = locald6.i();
                  } while (!bool);
                }
                if (k != 0) {
                  break;
                }
              } while (k != 0);
              if (locale2.d() < locale1.e())
              {
                locald6 = locale2.i();
                do
                {
                  if ((k == 0) && (locald6 == null)) {
                    break label599;
                  }
                  if (bool) {
                    break;
                  }
                  if (k != 0) {
                    break label578;
                  }
                  if (locald6.e() == locale1)
                  {
                    if (k != 0) {
                      break label584;
                    }
                    paramq.a(locald6);
                  }
                  locald6 = locald6.j();
                } while (!bool);
              }
              do
              {
                locald6 = locale1.h();
                do
                {
                  if (locald6 == null) {
                    break label599;
                  }
                  if (bool) {
                    break;
                  }
                  if (locald6.f() == locale2) {
                    paramq.a(locald6);
                  }
                  locald6 = locald6.i();
                } while (!bool);
                j++;
              } while (k != 0);
            } while (!bool);
            locald3 = locald3.i();
          } while (k != 0);
        } while (!bool);
      } while (k != 0);
      d locald3 = locald2;
      do
      {
        do
        {
          if (locald3 >= locald1) {
            break label675;
          }
          if (bool) {
            break;
          }
          if (arrayOfBoolean[locald2][locald3] != 0) {
            arrayOfBoolean1[locald3] = false;
          }
          locald3++;
        } while (!bool);
        locald2--;
      } while (k != 0);
    } while (!bool);
    label261:
    label675:
    return;
  }
  
  private static void a(bb parambb, z paramz)
  {
    int i = m.b;
    boolean bool = m.a;
    label110:
    do
    {
      if (parambb.isEmpty()) {
        break;
      }
      bb localbb = new bb();
      Object localObject = parambb.m();
      parambb.remove(localObject);
      localbb.add(localObject);
      w localw = parambb.l();
      do
      {
        do
        {
          if (!localw.e()) {
            break label110;
          }
          e locale = localw.d();
          if (bool) {
            break;
          }
          if (((e)localObject).a(locale) != null)
          {
            parambb.remove(locale);
            localbb.add(locale);
            localObject = locale;
          }
          localw.f();
        } while (!bool);
        paramz.add(localbb);
      } while (i != 0);
    } while (!bool);
  }
  
  private static int[][] a(bb[] paramArrayOfbb, bb parambb, int[] paramArrayOfInt)
  {
    int i1 = m.b;
    boolean bool = m.a;
    int[] arrayOfInt = new int[paramArrayOfInt.length];
    int i = 0;
    do
    {
      if (i >= paramArrayOfbb.length) {
        break;
      }
      if ((i1 == 0) && (bool)) {
        break label106;
      }
      w localw1 = paramArrayOfbb[i].l();
      if (localw1.e())
      {
        arrayOfInt[paramArrayOfInt[localw1.d().f()]] = i;
        localw1.f();
      }
      for (;;)
      {
        if (i1 == 0) {
          if (!bool)
          {
            if (!bool) {
              break;
            }
            if (i1 != 0) {
              continue;
            }
            i++;
          }
        }
      }
    } while (!bool);
    label106:
    int[][] arrayOfInt1 = new int[paramArrayOfbb.length][arrayOfInt.length];
    int j = 0;
    int k;
    do
    {
      if (j >= paramArrayOfbb.length) {
        break;
      }
      k = 0;
      if (k < arrayOfInt.length)
      {
        arrayOfInt1[j][k] = 2147483647;
        k++;
      }
      for (;;)
      {
        if (i1 == 0) {
          if (!bool)
          {
            if (!bool) {
              break;
            }
            if (i1 != 0) {
              continue;
            }
            j++;
          }
        }
      }
    } while (!bool);
    w localw2 = parambb.l();
    localw2.i();
    label339:
    label341:
    label344:
    do
    {
      if (!localw2.e()) {
        break;
      }
      k = paramArrayOfInt[localw2.d().f()];
      a.c.m localm = localw2.d().n();
      do
      {
        do
        {
          do
          {
            if (!localm.e()) {
              break label344;
            }
            int m = paramArrayOfInt[localm.a().f().f()];
            if (bool) {
              break;
            }
            if (m <= arrayOfInt1[arrayOfInt[m]][m])
            {
              int n = 0;
              do
              {
                if (n >= paramArrayOfbb.length) {
                  break;
                }
                arrayOfInt1[n][k] = Math.min(arrayOfInt1[n][k], arrayOfInt1[n][m]);
                n++;
                if (i1 != 0) {
                  break label341;
                }
                if (bool) {
                  break label339;
                }
              } while (!bool);
            }
          } while (i1 != 0);
          localm.f();
        } while (!bool);
        arrayOfInt1[arrayOfInt[k]][k] = k;
        localw2.g();
      } while (i1 != 0);
    } while (!bool);
    return arrayOfInt1;
  }
  
  private static int[] d(q paramq)
  {
    int[] arrayOfInt = new int[paramq.k()];
    boolean bool = x.a(paramq, arrayOfInt);
    if (m.b == 0)
    {
      if (!bool) {
        throw new a("Graph must be acyclic for this operation");
      }
      paramq.a(null, l.b(db.a(arrayOfInt)));
    }
    return arrayOfInt;
  }
}


/* Location:           E:\idea\
 * Qualified Name:     a.a.jb
 * JD-Core Version:    0.7.0.1
 */